UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9J4hV+uLv6/HmfJL24thiERAnroqaz2YIIBjYHLVeI=' 
WHERE 
  key_id = '8422aa0f43262cdd8051f90331de8908b35887552fc427a673e6723bdb51e55f' 
  AND (
    token = 'q9J4hV+uLv6/HmfJL24thiERAnroqaz2YIIBjYHLVeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015