UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ev1+1rQgBYnG/T9HrG8t+PWJsTTVvtynNEOiu0ffQEk=' 
WHERE 
  key_id = '061b40d8e608c93d4d097582693d0dabe68c296016cb1f561040bb8fb424c300' 
  AND (
    token = 'ev1+1rQgBYnG/T9HrG8t+PWJsTTVvtynNEOiu0ffQEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043