UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p51IozdG13BthItsnZlJsw24m76BWYn1RHIiA7XJbac=' 
WHERE 
  key_id = '53d74a6cbc3edb9d341e6483aef434f8cf4622ea5c518147058206e355f31bd6' 
  AND (
    token = 'p51IozdG13BthItsnZlJsw24m76BWYn1RHIiA7XJbac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022