UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'woYI+mA3cCN83DbiLU4pdmsI0O3cTg1TXl9IJzurNQY=' 
WHERE 
  key_id = 'c5a70490987f91af2c2696a98d94aa1e287e53533b892efbd008feebb8c56964' 
  AND (
    token = 'woYI+mA3cCN83DbiLU4pdmsI0O3cTg1TXl9IJzurNQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028