UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n/sbgY7IUBUt7tSEPthaksyquusSKiKnhHu/rUcoNwE=' 
WHERE 
  key_id = '9511f1df8351ff14d5e240edbf52cd46068699ef711f8c86a4cd13dc6610baad' 
  AND (
    token = 'n/sbgY7IUBUt7tSEPthaksyquusSKiKnhHu/rUcoNwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029