UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ssOdTq5k7VRUSbJPUMAtPOsxXBE350mT7cm2pMd17Hg=' 
WHERE 
  key_id = '2230263fc8d49e478bbb54dc7bfe760f69033d9e1b37598739d3019ebd05a1a8' 
  AND (
    token = 'ssOdTq5k7VRUSbJPUMAtPOsxXBE350mT7cm2pMd17Hg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040