UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DbFSHO3fqpD+ukS+Pn6TAPUwIUNuYta4sDGc0uHlbFU=' 
WHERE 
  key_id = '85b66d210446dde83fbacf2df40613023dd8d28ada1917d8b2faa39851be148a' 
  AND (
    token = 'DbFSHO3fqpD+ukS+Pn6TAPUwIUNuYta4sDGc0uHlbFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031