UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mPk+VXcqKyO5fMJOUM7R9HJngc+QP1bgDxztcnVksWE=' 
WHERE 
  key_id = '27b2100216eefb754818031aae0e486a135875c225b0151dbb50cbc65dc17c8f' 
  AND (
    token = 'mPk+VXcqKyO5fMJOUM7R9HJngc+QP1bgDxztcnVksWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024