UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xhKScA9WG+qBq9w/xI75Ho9ZT+OWIIcvAizz+4o1lRg=' 
WHERE 
  key_id = 'f8d4334223dcfc9cb1b30df949f505c14ac379e50774e6634a9134a2930205e1' 
  AND (
    token = 'xhKScA9WG+qBq9w/xI75Ho9ZT+OWIIcvAizz+4o1lRg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038