UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hb65hrRRMGwXBo/wXtRsY9fCCEnyW2vyG1Fwr4ZJPXg=' 
WHERE 
  key_id = '372e12ba56cdaef77ad9f426ac565e3e621e81218e2a782b4a12c4b9720ea9fd' 
  AND (
    token = 'hb65hrRRMGwXBo/wXtRsY9fCCEnyW2vyG1Fwr4ZJPXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039