UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L3XcQMJYhfwnlaZg7K0WzqukzDawsuq37iEues7SREU=' 
WHERE 
  key_id = '31d5b269ae7081eaedb056f180b4abf191a7c013126e3628de3cbc3930a8ec16' 
  AND (
    token = 'L3XcQMJYhfwnlaZg7K0WzqukzDawsuq37iEues7SREU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076