UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B9kMIaOBNcOwNnPMlm8HbXeVp5ijaUAjd8hKKpEOqtk=' 
WHERE 
  key_id = '0d79ed2a128f3939db0b43f968781d7c8577955660e7eb0e01f0070f3b2188ea' 
  AND (
    token = 'B9kMIaOBNcOwNnPMlm8HbXeVp5ijaUAjd8hKKpEOqtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038