UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T9Y32XzjvnVtNRlxC16BKW9948xqi5Z1iInI+Gz4mKU=' 
WHERE 
  key_id = 'd489c3971705657c24cb35780b1451da3fc5cbd1c51557fce56417c55b0b3f53' 
  AND (
    token = 'T9Y32XzjvnVtNRlxC16BKW9948xqi5Z1iInI+Gz4mKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032