UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '13RiK+QPgcR99mBVmCW0halPRa/uczBJaeKFmdbrwXo=' 
WHERE 
  key_id = 'bdb0e9a8fffb645d502f5dad0614091f0dd8218b047f0a8f41b031d13487441d' 
  AND (
    token = '13RiK+QPgcR99mBVmCW0halPRa/uczBJaeKFmdbrwXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037