UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Br/eoHh5cFPLAA0SvPFXuuh8/f+4zT5+o4RKuEYbZ1s=' 
WHERE 
  key_id = '84f78dcbbd324a384252d65fec856b8cee4b19674917bf01dd5576c6e2ad3763' 
  AND (
    token = 'Br/eoHh5cFPLAA0SvPFXuuh8/f+4zT5+o4RKuEYbZ1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026