UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jQEcruRM6xknF98QzErFyuIVEo4waJ03K3tY8CHMiDk=' 
WHERE 
  key_id = '3131368cf32aa6b78e5fbdaeadfb4db6e727500937df7b2f7f0d3b103223c828' 
  AND (
    token = 'jQEcruRM6xknF98QzErFyuIVEo4waJ03K3tY8CHMiDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033