UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'StaZSmccw18awaGisWSxZgFbkCgJ0EoYTrCXUNnxB+Q=' 
WHERE 
  key_id = 'b9c65dbf3770d4b018edbd0497f2db7030e655144869fa6bb7048f0919f4bad7' 
  AND (
    token = 'StaZSmccw18awaGisWSxZgFbkCgJ0EoYTrCXUNnxB+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029